In [1]:
%pylab inline
pylab.rcParams['figure.figsize'] = 14, 10 # increase the default image size
import skrf as rf # scikit-rf : object-oriented approach to microwave engineering
In [2]:
# Importing home-made classes.
from icrh.antenna.conjugate_t import ConjugateT
from icrh.antenna.resonant_loop import ResonantDoubleLoop
from icrh.antenna.topica import TopicaResult
We import the three devices of our electric circuit: the bridge, the impedance transformer and the window. As the default frequency range defined in skrf is the GHz, we set the frequency unit to MHz (this is only in order to have nicer plot after).
In [3]:
bridge = rf.io.hfss_touchstone_2_network('../icrh/data/Sparameters/WEST/WEST_ICRH_bridge.s3p', f_unit='MHz')
impedance_transformer = rf.io.hfss_touchstone_2_network('../icrh/data/Sparameters/WEST/WEST_ICRH_impedance-transformer.s2p', f_unit='MHz')
window = rf.io.hfss_touchstone_2_network('../icrh/data/Sparameters/WEST/WEST_ICRH_window.s2p', f_unit='MHz')
Here we create a single resonant loop, and match it on a manually created plasma.
In [4]:
CT1 = ConjugateT(bridge, impedance_transformer, window)
CT1.get_network() # look at the port char impedance to see if everything is fine
Out[4]:
Set the capacitors to dummy values and plot the S11 on a loading complex impedance for example.
In [5]:
CT1.C = [60e-12, 60e-12]
CT1.load(1+30*1j).plot_s_db()
In [6]:
sol_single_CT = CT1.match(f_match=48e6, z_load=1+30*1j)
Load the bridge with the capacitor values found:
In [7]:
CT1.C = sol_single_CT.x
CT1.load(1+30*1j).plot_s_db(show_legend=False)
We assume here that the bridge, impedance transformer and window are the same for both resonant loop.
In [8]:
RL1 = ConjugateT(bridge, impedance_transformer, window, name='RL1')
RL2 = ConjugateT(bridge, impedance_transformer, window, name='RL2')
RL1.get_network() # port 0 is 30 Ohm input, ports 1 & 2 bridge outputs
Out[8]:
Let's create an antenna with uncoupled staps (in poloidal and toroidal)
In [9]:
Z_simple1 = 1+30*1j
Z_simple2 = 1+30*1j
# The Z matrix ports indexing follows TOPICA convention, that is indexes strap 1 and 3, and 2 and 4
# create a diagonal Z-matrix
Z_matrix_simple = np.diag([Z_simple1, Z_simple2, Z_simple1, Z_simple2])
# creating the associated network
plasma = rf.Network(s=rf.z2s(np.tile(Z_matrix_simple,(len(bridge.frequency),1,1)), z0=[13,13,13,13]))
plasma.frequency = bridge.frequency
plasma.z0 = [13.7,13.7,13.7,13.7]
plasma
Out[9]:
Creating a resonant double loop antenna loaded with the above plasma.
In [10]:
RDL = ResonantDoubleLoop(RL1, RL2, plasma)
Set the capacitors of the antenna do dummy values and plot the Sii for example.
In [11]:
RDL.C = [50e-12, 60e-12, 70e-12, 80e-12]
antenna = RDL.get_network()
antenna.plot_s_db(m=0, n=0)
antenna.plot_s_db(m=1, n=1)
title('unmatched antenna')
antenna
Out[11]:
In [12]:
f_match = 48e6
Z_match = [30 + 1j*0, 30 + 1j*0]
power_in = [1, 1] # in Watts
phase_in = [0, pi] # in radians
sol_simple = RDL.match(power_in, phase_in, f_match, Z_match)
Test how good is the solution that has been found.
In [13]:
RDL.C = sol_simple.x
antenna = RDL.get_network()
antenna.plot_s_db(m=0,n=0)
antenna.plot_s_db(m=1,n=1)
In [14]:
plot(RDL.get_f()/1e6, RDL.get_vswr_active(power_in, phase_in))
grid()
axis([40, 60, 1, 10])
xlabel('f [MHz]')
ylabel('VSWR')
Out[14]:
Here we connect a TOPICA coupling matrix to two resonant loops. Pay attention to the way TOPICA indexes the straps.
$$\begin{matrix}
2 & | & 1 \\
4 & | & 3
\end{matrix}$$
cf figure below
In [42]:
def TOPICA_plasma(s4p_filename):
'''
Returns a skrf Network from a Touchstone file which contains TOPICA plasma simulation.
The S-parameters are repeated for all frequencies for compatibility with skrf.
'''
plasma_TOPICA = rf.io.hfss_touchstone_2_network(s4p_filename)
plasma_TOPICA.frequency = bridge.frequency
plasma_TOPICA.s = np.tile(plasma_TOPICA.s, (len(plasma.frequency), 1, 1))
plasma_TOPICA.z0 = np.tile(plasma_TOPICA.z0, (len(plasma.frequency),1))
return plasma_TOPICA
In [38]:
plasma_TOPICA = TOPICA_plasma('../icrh/data/Sparameters/WEST/plasma_from_TOPICA/S_TSproto12_55MHz_Profile8.s4p')
print(plasma_TOPICA)
print(bridge)
In [39]:
f_match = 55e6
Z_match = [30+1j*0, 30+1j*0]
power_in = [1, 1]
phase_in = [0, pi]
In [40]:
CT1 = ConjugateT(bridge, impedance_transformer, window)
CT2 = ConjugateT(bridge, impedance_transformer, window)
RDL = ResonantDoubleLoop(CT1, CT2, plasma_TOPICA)
sol_TOPICA = RDL.match(power_in, phase_in, f_match, Z_match)
For the same set of capacitor values found, we vary the plasma load and plot scattering parameters and VSWR
In [43]:
RDL.plasma = TOPICA_plasma('../icrh/data/Sparameters/WEST/plasma_from_TOPICA/S_TSproto12_55MHz_Profile1.s4p')
subplot(321)
RDL.get_network().plot_s_db(m=0,n=0)
RDL.get_network().plot_s_db(m=1,n=1)
axis([40,60,-50,0])
legend(('S11', 'S22'),loc='best')
subplot(322)
plot(RDL.get_f()/1e6, 20*np.log10(np.abs(RDL.get_s_active(power_in, phase_in))))
legend(('Sact1', 'Sact2'),loc='best')
axis([40,60,-50,0])
RDL.plasma = TOPICA_plasma('../icrh/data/Sparameters/WEST/plasma_from_TOPICA/S_TSproto12_55MHz_Profile4.s4p')
subplot(323)
RDL.get_network().plot_s_db(m=0,n=0)
RDL.get_network().plot_s_db(m=1,n=1)
axis([40,60,-50,0])
legend(('S11', 'S22'),loc='best')
subplot(324)
plot(RDL.get_f()/1e6, 20*np.log10(np.abs(RDL.get_s_active(power_in, phase_in))))
legend(('Sact1', 'Sact2'),loc='best')
axis([40,60,-50,0])
RDL.plasma = TOPICA_plasma('../icrh/data/Sparameters/WEST/plasma_from_TOPICA/S_TSproto12_55MHz_Profile8.s4p')
subplot(325)
RDL.get_network().plot_s_db(m=0,n=0)
RDL.get_network().plot_s_db(m=1,n=1)
axis([40,60,-50,0])
legend(('S11', 'S22'),loc='best')
subplot(326)
plot(RDL.get_f()/1e6, 20*np.log10(np.abs(RDL.get_s_active(power_in, phase_in))))
legend(('Sact1', 'Sact2'),loc='best')
axis([40,60,-50,0])
Out[43]:
In [44]:
RDL.plasma = TOPICA_plasma('../icrh/data/Sparameters/WEST/plasma_from_TOPICA/S_TSproto12_55MHz_Profile1.s4p')
subplot(311)
plot(RDL.get_f()/1e6, RDL.get_vswr_active(power_in, phase_in), lw=2)
axis([40,60,1,6])
grid()
title('"Active" VSWR')
RDL.plasma = TOPICA_plasma('../icrh/data/Sparameters/WEST/plasma_from_TOPICA/S_TSproto12_55MHz_Profile4.s4p')
subplot(312)
plot(RDL.get_f()/1e6, RDL.get_vswr_active(power_in, phase_in), lw=2)
axis([40,60,1,6])
grid()
RDL.plasma = TOPICA_plasma('../icrh/data/Sparameters/WEST/plasma_from_TOPICA/S_TSproto12_55MHz_Profile8.s4p')
subplot(313)
plot(RDL.get_f()/1e6, RDL.get_vswr_active(power_in, phase_in), lw=2)
axis([40,60,1,6])
grid()
xlabel('f [MHz]')
Out[44]:
In [ ]: